package com.springboot.admin.servlet;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.io.IOException;

/************************************************************************
 *
 *    Copyright  Copyright 2021 Google Inc.
 *    File Name: MyFilter
 *    Description: 自定义Filter
 *
 *    Version: V1.0
 *    Author: Fuc
 *    Create Time: 2021-01-08
 *
 *************************************************************************/

@Slf4j
//@WebFilter(urlPatterns={"/css/*","/images/*"}) //my
public class MyFilter implements Filter {
  @Override
  public void init(FilterConfig filterConfig) throws ServletException {
    log.info("MyFilter初始化完成");
  }

  @Override
  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
      throws IOException, ServletException {
    log.info("MyFilter工作");
    chain.doFilter(request, response);
  }

  @Override
  public void destroy() {
    log.info("MyFilter销毁");
  }
}
